package com.nongcai159.mall.lib_common.base

import android.app.Activity
import android.content.Intent

import com.nongcai159.mall.lib_common.utils.ScreenSupport

/**
 * Activity基类的事件
 *
 *
 * Created by tanbiheng on 2018/11/26.
 */

class BaseActivityAction {
    fun onCreate(activity: Activity) {
        ActivityStackManager.INSTANCE.pushActivity(activity)

        // 初始化屏幕参数
        if (ScreenSupport.SCREEN_WIDTH == 0 || ScreenSupport.SCREEN_HEIGHT == 0) {
            ScreenSupport.displayMetrics(activity)
        }
    }

    fun onNewIntent(intent: Intent, activity: Activity) {
        ActivityStackManager.INSTANCE.popActivityNoFinish(activity)
        ActivityStackManager.INSTANCE.pushActivity(activity)
    }


    fun onResume(activity: Activity) {

    }

    fun onPause(activity: Activity) {
        // 初始化屏幕参数
        if (ScreenSupport.SCREEN_WIDTH == 0 || ScreenSupport.SCREEN_HEIGHT == 0) {
            ScreenSupport.displayMetrics(activity)
        }

    }

    fun onStop(activity: Activity) {

    }

    fun onDestroy(activity: Activity) {
        ActivityStackManager.INSTANCE.popActivity(activity)
    }
}
